<?php
namespace app\index\controller;

use \think\Controller;
//use think\facade\Request;
use think\Db;
use think\facade\Request;
use app\index\controller\Base;
class Index extends  Controller
{
    public function index()
    {
    	//广告位
    	$goods = Db::table('shop_goods')
    	->where('goods_cate_id',28)
		->limit(4)
    	->select();
		$this->assign('goods',$goods); 
		//最新产品
		$latest = Db::table('shop_goods')
		->order('create_time', 'desc')
		->limit(6)
		->select();
		$this->assign('latest',$latest);  
		//热门产品
		$hottest = Db::table('shop_goods')
		->join('shop_goods_detail','shop_goods.id=shop_goods_detail.shop_goods_id')
		->order('click_times', 'desc')
		->limit(4)
		->select();
		$this->assign('hottest',$hottest);
		//推荐产品
		$recommend = Db::table('shop_goods')
		->join('shop_goods_detail','shop_goods.id=shop_goods_detail.shop_goods_id')
		->order('weight', 'desc')
		->limit(6)
		->select();
		$this->assign('recommend',$recommend);      	
    	return $this->fetch();
    } 
	public function logout()
	{
		session('userinfo',null);
		$this->success('退出成功','index/index/index');exit;
	}
}
